package com.pomodorotechnique.activity;

import org.w3c.dom.ls.LSException;

import sun.awt.SunHints.LCDContrastKey;

import com.pomodorotechnique.R;
import com.pomodorotechnique.toolkit.Pomo_Application;

import android.app.Activity;
import android.app.Application;
import android.app.ExpandableListActivity;
import android.content.Context;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.RatingBar;
import android.widget.SimpleCursorTreeAdapter;
import android.widget.TextView;

public class CollectionBoxActivity extends Activity {


	private ListView lv;
	public CollectionListAdapter adapter;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_collectionbox);
		
		lv = (ListView)findViewById(R.id.collection_list);
		adapter = new CollectionListAdapter(this);
		lv.setAdapter(adapter);
		lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
		
			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				// TODO Auto-generated method stub
				//System.out.println(id);
				adapter.notifyDataSetChanged();
			}
		});
		
		
		
	}
	@Override
	protected void onRestart() {
		// TODO Auto-generated method stub
		super.onRestart();
		if(((Pomo_Application)getApplication()).getIsNewTaskAdd()){
			System.out.println("get notice");
			adapter.notifyDataSetChanged();
			lv.invalidateViews();
			((Pomo_Application)getApplication()).setIsNewTaskAdd(false);
		}
	}
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
	}
		
}
